<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="/commons/taglibs.jsp" %>
<!DOCTYPE HTML>
<html>
<head>
    <link rel="stylesheet" href="${ctx}/css/login.css"/>
    <title>知识产权综合服务应用平台</title>
</head>
<body>
<div id="container">
    <div id="bd">
        <div class="login">
            <form action="${ctx}/login" id="form" method="post" autocomplete="off">
                <div class="login-top"><h1 class="logo"></h1></div>
                <div class="login-input">
                    <p class="user ue-clear">
                        <label>用户名</label>
                        <input type="text" name="username" autocomplete="off"/>
                    </p>
                    <p class="password ue-clear">
                        <label>密&nbsp;&nbsp;&nbsp;码</label>
                        <input type="password" name="password" autocomplete="off"/>
                    </p>
                    <p class="checkcode ue-clear">
                        <label>验证码</label>
                        <input type="text" name="captcha" style="width:95px"/>
                        <img onclick="this.src='${ctx}/captcha.jpg?'+new Date()"
                             style="cursor: pointer; width: 100px; height: 39px; position: fixed;"
                             src="${ctx}/captcha.jpg"/>
                    </p>
                </div>
                <div class="login-btn ue-clear">
                    <a href="javascript:login();" class="btn">登录</a>
                </div>
            </form>
        </div>
    </div>
</div>
<div id="ft">CopyRight&nbsp;2018&nbsp;&nbsp;版权所有&nbsp;&nbsp;宁ICP备12345678号</div>
</body>
<script src="${ctx}/bower_components/jquery/dist/jquery.min.js"></script>
<script type="text/javascript">
    $(document).ready(function () {
        var height = $(window).height();
        $("#container").height(height);
        $("#bd").css("padding-top", height / 2 - $("#bd").height() / 2);

        $(window).resize(function () {
            var height = $(window).height();
            $("#bd").css("padding-top", $(window).height() / 2 - $("#bd").height() / 2);
            $("#container").height(height);

        });

        $('#remember').focus(function () {
            $(this).blur();
        });

        $('#remember').click(function (e) {
            checkRemember($(this));
        });

        function checkRemember($this) {
            if (!-[1,]) {
                if ($this.prop("checked")) {
                    $this.parent().addClass('checked');
                } else {
                    $this.parent().removeClass('checked');
                }
            }
        }
    });

    function login() {
        var username = $('input[name=username]').val().trim();
        if (username.length === 0) {
            alert("用户名不能为空！");
            return;
        }
        var password = $('input[name=password]').val().trim();
        if (password.length === 0) {
            alert("密码不能为空！");
            return;
        }
        var captcha = $('input[name=captcha]').val().trim();
        if (captcha.length === 0){
            alert("验证码不能为空！");
            return;
        }
        $('#form').submit();
    }
</script>
</html>
